home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / Aidan's Class Libraries / Source / Layout Classes / WindowDrawer.cpp < prev   
Encoding:
Text File  |  1997-07-20  |  991 b   |  45 lines  |  [TEXT/CWIE]

  1. //Copyright (c) 1997 Aidan Cully
  2. //All rights reserved
  3.  
  4. #include "CLWindowDrawer.h"
  5. #include "CLBaseWindow.h"
  6. #include "CLApplication.h"
  7.  
  8. TWindowDrawer::TWindowDrawer( TLayoutBranch *super ):
  9.     TLayoutLeaf( super )
  10. {
  11. }
  12.  
  13. void TWindowDrawer::AttachedToWindow( TBaseWindow *win, Rect r )
  14. {
  15.     TLayoutLeaf::AttachedToWindow( win, r );
  16.     win->AddDrawer( this );
  17. }
  18.  
  19. void TWindowDrawer::DrawSelf( TDrawSlate *d )
  20. {
  21. }
  22.  
  23. void TWindowDrawer::DrawWindow( TBaseWindow *win )
  24. {
  25.     GrafPtr oldPort;
  26.     GDHandle oldDevice, dev;
  27.     GWorldPtr oldWorld, world;
  28.  
  29.     ::GetGWorld( &oldWorld, &oldDevice );
  30.     TApplication::SCurApp()->GetGlobalWorld( world, dev );
  31.     ::SetGWorld( world, dev );
  32.     ::GetPort( &oldPort );
  33.     ::SetPort( win->GetWindow() );
  34.     RgnHandle clip= ::NewRgn();
  35.     RgnHandle oldClip= ::NewRgn();
  36.     ::GetClip( oldClip );
  37.     GetClip( clip );
  38.     ::SetClip( clip );
  39.     DrawWindowSelf( win );
  40.     ::SetClip( oldClip );
  41.     ::DisposeRgn( oldClip );
  42.     ::DisposeRgn( clip );
  43.     ::SetPort( oldPort );
  44.     ::SetGWorld( oldWorld, oldDevice );
  45. }